-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 0-Task Plans in Single-Shard Router When Updating a Local Table with Reference Table in Subquery #7897
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release-13.0 #7897 +/- ##
================================================
- Coverage 89.48% 89.46% -0.02%
================================================
Files 276 276
Lines 60063 60009 -54
Branches 7524 7516 -8
================================================
- Hits 53747 53687 -60
- Misses 4166 4173 +7
+ Partials 2150 2149 -1 |
m3hm3t
commented
Feb 13, 2025
colm-mchugh
reviewed
Feb 14, 2025
colm-mchugh
reviewed
Feb 14, 2025
colm-mchugh
reviewed
Feb 14, 2025
colm-mchugh
reviewed
Feb 17, 2025
a843139
to
ce9915d
Compare
colm-mchugh
approved these changes
Feb 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks for accommodating the test requests.
…for clarity and update related documentation
…f local and reference tables
…dling of local and reference tables
…nting DELETE and MERGE operations to validate reference table handling
…ns in issue 7891 tests
…sue 7891 tests for clarity
0dec699
to
6fd8a85
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue #7891 in the Citus planner where an
UPDATE
on a local table with a subquery referencing a reference table could produce a 0-task plan. Historically, the planner sometimes failed to detect that both the target and referenced tables were effectively “local,” assigningINVALID_SHARD_ID
and yielding a no-op plan.Root Cause
PlanRouterQuery
), we relied onshardId
to determine whether a query should be routed to a single shard.shardId == INVALID_SHARD_ID
, but we also had not marked the query as a “local table modification,” the code path would produce zero tasks.Changes
Enhanced Local Table Detection
IsLocalTableModification
and related checks to consider both local and reference tables as “local” for planning, preventing the 0-task scenario.ContainsOnlyLocalOrReferenceTables
to return true if there are no fully distributed tables in the query.Added Regress Test
issue_7891.sql
) which reproduces the scenario.